package com.ribbon.service;

import com.netflix.discovery.converters.Auto;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

/**
 * Created by Administrator on 2017/6/23.
 */
@Service
public class UserService {

    @Autowired
    private RestTemplate restTemplate;


    @HystrixCommand(fallbackMethod = "hiError")
    public void hiUserService(){
        restTemplate.getForObject("http://eureka-client/user/name?name="+123,String.class);
    }

    public void hiError() {
        System.out.println("aaa");
    }
}
